package com.wnhz.work.jy.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.wnhz.work.jy.R;

import java.util.List;

/**
 * Created by d on 2016/9/19.
 */
public class SearchLisrViewAdapter extends BaseAdapter {

    private Context context;
    private List<String> mList;

    public SearchLisrViewAdapter(Context context, List<String> mList) {
        this.context = context;
        this.mList = mList;
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        MyHolder holder;
        if (convertView == null){
            holder = new MyHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.iten_searchlisrview,null);
            holder.textView = (TextView) convertView.findViewById(R.id.text);
            convertView.setTag(holder);
        }
        holder = (MyHolder) convertView.getTag();
        holder.textView.setText(mList.get(position));
        return convertView;
    }

    private class MyHolder{
        TextView textView;
    }
}
